//
//  NickNameViewController.swift
//  OnceNectar
//
//  Created by 法正磊 on 2018/3/5.
//  Copyright © 2018年 com.inwhoop. All rights reserved.
//

import UIKit
import PKHUD

class NickNameViewController: BaseViewController, AddCornerUIRectCorner, BottomShadow, UITextFieldDelegate {
    @IBOutlet weak var mainView: UIView!
    @IBOutlet weak var nameTextField: UITextField!
    
    typealias selectBlock = (_ name: String) -> Void
    var select: selectBlock?
    var nameVal:String = ""
    override func viewDidLoad() {
        super.viewDidLoad()
        setUI()
        // Do any additional setup after loading the view.
    }
    
    func setUI() {
        titleLabel(text: "个人信息", nil)
        nameTextField.text = nameVal
        setShadow(view: mainView, opacity: bottomShadowOpacity, size: bottomShadowOffset, color: UIColor.black, cornerradius: CORNERRADIUS)
    }
    
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        textField.resignFirstResponder()
        return true
    }
    
    func textFieldDidEndEditing(_ textField: UITextField) {
        let text1 = textField.text?.count
        if text1 == 0 {
             self.showToast(msg:"请输入内容")
        }
        self.navigationController?.popViewController(animated: true)
        self.select!(textField.text!)
    }
    
    override func setNavigation() {
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
